const { spawn } = require('child_process');
const path = require('path');

// 启动翻译服务器
const server = spawn('node', ['index.js'], {
  cwd: __dirname,
  stdio: 'inherit'
});

console.log('启动翻译服务器...');

server.on('close', (code) => {
  console.log(`翻译服务器已关闭，退出码: ${code}`);
});

process.on('SIGINT', () => {
  console.log('接收到中断信号，关闭翻译服务器...');
  server.kill('SIGINT');
  process.exit(0);
});